import { request , requestMock} from "@/utils/http";

export const getCategoryListRequest = ()=>{
    return request.get('/api/product/getBaseCategoryList')
}

//请求轮播图数据，目前使用mock测试
export const getBannerRequest = ()=>{
    return requestMock.get('/banner')
}

//请求floor数据
export const getFloorListRequest=()=>{
    return requestMock.get('floor')
}

//请求搜索页的数据,这里是post请求传递一个params对象
export const getSearchListRequest = (params)=>{
    return request.post('/api/list',params)
}

//请求商品详情页数据
export const getDetailDataRequest = (skuId)=>{
    return request.get(`api/item/${skuId}`)
}

//发送商品id 请求购物车,添加购物车增减的
export const getAddToCartRequest = ({ skuId, skuNum })=>{
    return request.post(`/api/cart/addToCart/${skuId}/${skuNum}`)
}

//购物车页面的数据请求,直接在购物车页面请求
export const getShopCartRequest = ()=>{
    return request.get(`/api/cart/cartList`)
}

//单选框的选择请求
export const getChangeSingleCheckedRequest =({skuId,isChecked})=>{
    return request.get(`/api/cart/checkCart/${skuId}/${isChecked}`)
}

//全选购物车的请求
export const shopCartAllCheckedRequest = (isChecked, skuIdList)=>{
    return request.post(`/api/cart/batchCheckCart/${isChecked}`,skuIdList)
}

//删除单个商品的请求
export const deleteGoodsRequest = (skuId)=>{
    return request.delete(`/api/cart/deleteCart/${skuId}`)
}

//删除购物车所有商品请求
export const deleteAllGoodsRequest=(skuIdList)=>{
    return request.delete(`/api/cart/batchDeleteCart`,{
        data:skuIdList
    })
}

//获取验证码逻辑
export const requestVerifyCode=(phone)=>{
    return request.get(`/api/user/passport/sendCode/${phone}`)
}

//注册逻辑
export const requestRegister=(registerInfo)=>{
    return request.post(`/api/user/passport/register`, registerInfo)
}


